package com.autonavi.yunda.yunji.controller;

import com.autonavi.yunda.yunji.domain.OrmTableParam;
import com.autonavi.yunda.yunji.service.OrmTableService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;


/**
 * @author: zhouzy
 * @create: 2022-07-01 16:20
 * @description:单表orm语句处理
 **/
@RestController
public class OrmTableController {

    @Resource
    OrmTableService ormTableService;

    @PostMapping(value = "/orm/sql", headers = {"Content-Type=application/json"})
    public Map<String, Object> ormSql(@RequestBody OrmTableParam param) {
        Map<String, Object> map = new HashMap<>(8);
        String sql = ormTableService.getSql(param);
        map.put("sql", sql);
        return map;
    }
}
